// clicklabel.h
#pragma once
#include <QLabel>
#include <QMouseEvent>
#include <QEvent>

class ClickLabel : public QLabel {
    Q_OBJECT
public:
    explicit ClickLabel(QWidget *parent = nullptr) : QLabel(parent) {}

signals:
    void clicked();  // 自定义点击信号
    void hovered();  // 添加悬浮信号

protected:
    void mouseReleaseEvent(QMouseEvent *event) override {
        if (event->button() == Qt::LeftButton) {
            emit clicked();  // 左键点击时发出 clicked 信号
        }
    }
    void enterEvent(QEnterEvent *event) override{
        emit hovered();


        QLabel::enterEvent(event);
    }  // 新增悬浮事件
    void leaveEvent(QEvent *event) override
    {

        QLabel::leaveEvent(event);

    }
};

